<#assign menu="goods">
<#assign submenu="update_goods">
<#include "../../manage/head.ftl">
<!--main content start-->
<style type="text/css">

</style>
<section id="main-content">
    <section class="wrapper">
        <!-- page start-->
        <form id="update_goods_form" class="form-horizontal" action="${BASE_PATH}/manage/goods/update.json"
              autocomplete="off" method="post"
              enctype="multipart/form-data">
            <fieldset>
                <div class="row">
                    <input type="hidden" name="goodsId" value="${goods.id}">

                    <div class="col-lg-12">
                        <section class="panel">
                            <header class="panel-heading">
                                编辑商品
                            </header>
                            <div class="panel-body">
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">主题图片</label>

                                    <div class="col-sm-10">
                                        <img src="${image}" alt="img04" style="height:120px;">
                                        <input type="file" name="file"
                                               id="file">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">展示图片</label>

                                    <div class="col-sm-10">
                                        <#list imageList1 as e>
                                            <img src="${e.path}" alt="img04" style="height:120px;">
                                            <input type="file" name="file1"
                                                   id="file">
                                         </#list>
                                    </div>

                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">名字</label>

                                    <div class="col-sm-10">
                                        <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                               name="name"
                                               placeholder="名字" id="name" value="${goods.name}">
                                        </input>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">价格</label>

                                    <div class="col-sm-10">
                                        <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                               name="price"
                                               placeholder="价格" id="name" value="${goods.price}">
                                        </input>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">类型</label>

                                    <div class="col-sm-10">
                                        <select class="form-control" name="typeId" id="goodsType-select"
                                                style="font-size:15px;width: 300px;">
                                        <#list typeList as type>
                                            <option value="${type.id}">
                                            ${type.name}
                                            </option>
                                        </#list>
                                        </select>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">原料</label>

                                    <div class="col-sm-10">
                                        <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                               name="material"
                                               placeholder="原料" id="material" value="${goods.material}">
                                        </input>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">生产商</label>

                                    <div class="col-sm-10">
                                        <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                               name="manufacturer"
                                               placeholder="生产商" id="manufacturer" value="${goods.manufacturer}">
                                        </input>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">备注</label>

                                    <div class="col-sm-10">
                                        <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                               name="mark"
                                               placeholder="备注" id="manufacturer" value="${goods.mark}">
                                        </input>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">配送费</label>

                                    <div class="col-sm-10">
                                        <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                               name="shippingPrice"
                                               placeholder="配送费" id="manufacturer" value="${goods.shippingPrice}">
                                        </input>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <div class="col-lg-offset-2 col-lg-10">
                                        <button class="btn btn-shadow btn-primary" type="submit">发布</button>
                                    </div>
                                </div>
                            </div>

                        </section>

                    </div>
                </div>
            </fieldset>
        </form>
        <!-- page end-->
    </section>
</section>

<script type="text/javascript">

    $(function () {
        $('#update_goods_form').ajaxForm({
            dataType: 'json',
            success: function (data) {
                if (data.result) {
                    bootbox.alert("保存成功，将刷新页面", function () {
                        window.location.reload();
                    });
                } else {
                    showErrors($('#update_goods_form'), data.errors);
                }
            }
        });

        $('.js_create_time').datetimepicker({
            language: 'zh-CN',
            format: "yyyy-mm-dd",
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0
        });
    });

    $("#goodsType-select").val("${goods.typeId}");
</script>
<#include "../../manage/foot.ftl">
